/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import request from '../utils/request';
const time = new Date().getTime()

function requestApi(run,params='',url='/Api/Handle/run',method='POST'){
  return request(url, {
    method,
    body:{
      data:JSON.stringify({
        data:params,
        run,
        time
      })
    }
  });
}

// 获取历史订单数据
export async function getHistoryList(params) {
  return requestApi('/DeliveryOrderCount/historyDetails',params)
}


//获取折线图数据
export async function getChartList(params) {
  return  requestApi('/DeliveryOrderCount/shopHistoryStatistics',params)
}

//获取配送费计价列表
export async function getValuationList(params) {
  return requestApi('/Valuation/show',params)
}

//改变配送费计价开启与否
export async function changeValuation(params) {
  return requestApi('/Valuation/switch',params)
}

//删除配送费计jia
export async function deleteValuation(params) {
  return requestApi('/Valuation/delete',params)
}

//添加配送费计价
export async function saveValuation(params) {
  return requestApi('/Valuation/addPlan',params)
}

//获取配送费结算列表
export async function getCostList(params) {
  return requestApi('/Order/feeSettlementList',params)
}

//批量或单个发放配送费
export async function giveCostOut(params) {
  return  requestApi('/Order/callPay',params)
}

//配送费结算及发放设置
export async function costSetting(params) {
  return requestApi('/ShippingFee/add',params)
}

//获取配送规则
export async function getSingleCost(){
  return requestApi('/ShippingFee/index')
}